/**
 * 请求比赛列表
 */
export const fetchRaceListData = function (data = {}) {
  console.log("请求比赛列表", data);
  return new Promise((resolve) => {
    setTimeout(() => {
      resolve({
        code: 1,
        data: {
          total: 3,
          items: [
            {
              id: 239121,
              startTime: new Date("2023-12-12 12:00:00").getTime(),
              endTime: new Date("2023-12-12 13:45:23").getTime(),
              otherTeamName: "甜甜圈队",
              myTeamScore: 2,
              otherTeamScore: 1,
              foulTotalNumber: 3,
            },
            {
              id: 589328,
              startTime: new Date("2024-01-10 09:40:00").getTime(),
              endTime: new Date("2024-01-10 11:22:23").getTime(),
              otherTeamName: "甜甜圈队1",
              myTeamScore: 1,
              otherTeamScore: 2,
              foulTotalNumber: 4,
            },
            {
              id: 589328,
              startTime: new Date("2024-01-23 14:20:00").getTime(),
              endTime: new Date("2024-01-23 16:01:11").getTime(),
              otherTeamName: "甜甜圈队2",
              myTeamScore: 2,
              otherTeamScore: 2,
              foulTotalNumber: 5,
            },
          ],
        },
      });
    }, 800);
  });
};

/**
 * 请求比赛详情
 */
export const fetchRaceDetailData = function (data = {}) {
  console.log("请求比赛详情", data);

  return new Promise((resolve) => {
    setTimeout(() => {
      resolve({
        code: 1,
        data: {
          startTime: new Date("2023-12-28 12:00:00").getTime(),
          endTime: new Date("2023-12-28 13:42:12").getTime(),
          otherTeamName: "甜甜圈队1",
          myTeamScore: 0,
          otherTeamScore: 1,
          foulTotalNumber: 5, // 犯规总数
          assistTotalNumber: 14, // 助攻总数
          outstandingTotalNumber: 18, // 过人总数
          diveTotalNumber: 4, // 扑救总数
          helpTotalNumber: 3, // 解围总数
        },
      });
    }, 800);
  });
};

/**
 * 请求比赛上场人员
 */
export const fetchRacePlayerListData = function (data = {}) {
  console.log("请求比赛上场人员", data);
  return new Promise((resolve) => {
    setTimeout(() => {
      resolve({
        code: 1,
        data: [
          {
            id: 10001,
            name: "张三",
            position: 1001,
            clothNumber: 24,
            score: 1, // 得分
            assistNumber: 0, // 助攻
            foulNumber: 2, // 犯规
            outstanding: 4, // 过人
            diveNumber: 0, // 扑救
            helpNumber: 0, // 解围
          },
        ],
      });
    }, 300);
  });
};

/**
 * 新增比赛
 */
export const fetchRaceAdd = function (data = {}) {
  console.log("新增比赛", data);
  return new Promise((resolve) => {
    setTimeout(() => {
      resolve({ code: 1, data: true });
    }, 800);
  });
};

/**
 * 编辑比赛
 */
export const fetchRaceEdit = function (data = {}) {
  console.log("编辑比赛", data);
  return new Promise((resolve) => {
    setTimeout(() => {
      resolve({ code: 1, data: true });
    }, 800);
  });
};
